-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge light clients config in relayer config and add commands to add/remove light clients #348
Conversation
My concern with these commands is UX, the user has to do some work to retrieve the peer-id, hash, height, etc.
And obtain all the info from the |
#[serde(default = "default::trusting_period", with = "humantime_serde")] | ||
pub trusting_period: Duration, | ||
#[serde(default)] | ||
pub trust_threshold: TrustThreshold, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in the client config? Same question for the trusting_period
? Different apps may use different clients of same chain if they have different security requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracked in #356
Good point! Couple questions:
|
I think the user should be able to specify any number of params, at the minimum the rpc
That would be nice :) |
Done. Here's the new usage of the
I also adapted the options for the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks Romain!
…remove light clients (informalsystems#348) * Implement command to add light client peer * Implement command to remove light client peer * Refactor config * Formatting * Cleanup * Cleanup deps * Fix start command * Cleanup example config * Add test for serializing config * Fix TOML serialization issue * Comments, bugfix, and better names * Fetch peer id, block hash and height from given node via RPC * Adapt light rm options for consistency with light add * Update changelog
Description
This PR merge the light clients config (previously in
light_clients.toml
) in the main relayer config and add commands to add/remove light clients.Commands
relayer light
relayer light add
relayer light rm
Caveat
The main downside of this PR is that running either of the commands above will remove any comments or formatting in the config file. This could be improved by using format-preserving TOML parser/serializer (see
toml_edit
), but it would be a substantial amount of work to manually apply the config changes to the parsed TOML value withtoml_edit
. Definitely something to revisit in the future.The main downside of this PR is that running either of the commands above will "scramble" the config file when writing the new configuration to it.This stems from the fact I have not figured out a way to express our config structs so that they can be serialized to a TOML string directly via serde.
As a workaround, I am serializing the config struct to a TOML
Value
first and then serializing that to a string. Unfortunately, this does not respect the field order of the Rust structs and thus scrambles the original file (but preserves its semantics, thankfully).I see a few potential ways out of that:
a) figure out how to express the config so that it can be directly serialized to a TOML string via Serde (no luck so far)
b) use a format-preserving TOML parser/serializer (see
toml_edit
)c) move to another config format (Dhall, RON, ?)
Pros
a) quick fix if we can figure it out
b) would preserve formatting and comments
c) no need to massage our config struct to fit into what's accepted by TOML
Cons
a) comments and formatting would still be lost
b) it might take a substantial amount of work to manually apply the config changes to the parsed TOML value with
toml_edit
.c) comments and formatting would still be lost
For contributor use:
docs/
) and code comments.Files changed
in the Github PR explorer.